package net.haiyue.api.custom;

import java.io.Serializable;

public class JsonResult  implements Serializable {
    private static final String STATUS_SUCCESS = "success";

    private static final String STATUS_ERROR = "error";

    private String status;

    private Object data;

    public JsonResult(String status, Object data){
        this.status = status;
        this.data = data;
    }

    public static JsonResult success(Object data){
        return new JsonResult(STATUS_SUCCESS, data);
    }

    public static JsonResult success(){
        return success(null);
    }

    public static JsonResult error(Object data){
        return new JsonResult(STATUS_ERROR, data);
    }

    public static JsonResult error(){
        return error(null);
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
